package com.itheima.reggie.controller;


import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.service.IDishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dish")
@SuppressWarnings("unchecked")
public class DishController {

        @Autowired
        private IDishService dishService;

        // h5菜品展示
        @GetMapping("/list")
        public ResultInfo dishList(Long categoryId, Integer status) {// 1.接收参数
            // 2.调用service
            List<Dish> dishList = dishService.findDishList(categoryId, status);
            // 3.返回结果
            return ResultInfo.success(dishList);

        }

}
